import { createRouter, createWebHistory } from 'vue-router'

import MyInfo from "@/views/info/MyInfo.vue";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'login',
      component: () => import('../views/login/Login.vue')
    },
    // {
    //   path: '/profile',
    //   name: 'profile',
    //   // route level code-splitting
    //   // this generates a separate chunk (About.[hash].js) for this route
    //   // which is lazy-loaded when the route is visited.
    //   component: () => import('../views/profile/Profile.vue')
    // },
    {
      path: '/profile',
      component: () => import('../views/profile/Profile.vue'),
      // 重定向
      redirect: '/myinfo',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      // component: () => import('../views/profile/Profile.vue')
      children:[
        {
          path:'/myinfo',
          name:'myinfo',
          component: MyInfo,
        },
        {
          path:'/alltheinfo',
          name:'alltheinfo',
          component: () => import('../views/info/AllTheInfo.vue'),
        },
        {
          path:'/searchArticle',
          name:'searchArticle',
          component: () => import('../views/article/searchArticle.vue'),
        },
        {
          path:'/articleClass',
          name:'articleClass',
          component: () => import('../views/article/articleClass.vue'),
        }

      ]
    }
  ]
})

export default router
